package com.dragon.mmochat.model.bet;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class MmochatBetInfo {
	private int roleId;
	// 压注序号-->压注金额
	private Map<Integer, Integer> betMoneyMap = new ConcurrentHashMap<Integer, Integer>();

	public int getRoleId() {
		return roleId;
	}

	public void setRoleId(int roleId) {
		this.roleId = roleId;
	}

	public Map<Integer, Integer> getBetMoneyMap() {
		return betMoneyMap;
	}

	public void setBetMoneyMap(Map<Integer, Integer> betMoneyMap) {
		this.betMoneyMap = betMoneyMap;
	}

	public int getTotalBetMoney() {
		int total = 0;
		for (Integer money : betMoneyMap.values()) {
			total += money;
		}
		return total;
	}

	public int getAwardMoney(int hitIndex, double award, int myCurrMoney){
		long total = -1 * getTotalBetMoney();
		Integer hitMoney = betMoneyMap.get(hitIndex);
		if (hitMoney != null){
			total += (long) (hitMoney * award);
			total += myCurrMoney;
			total = Math.min(Integer.MAX_VALUE, total);
			total -= myCurrMoney;
		}
		return (int)total;
	}
}
